let nav = document.querySelector(".nav");
let flag = true;
document.addEventListener("scroll", () => {
  let layerY = document.documentElement.scrollTop;
  if (layerY > 270) {
    if (flag) {
      nav.style.height = "60px";
      nav.style.backgroundColor = "white";
      nav.style.color = "black";
      flag = !flag;
    }
  } else {
    if (!flag) {
      nav.style.height = "80px";
      nav.style.backgroundColor = "black";
      nav.style.color = "white";
      flag = !flag;
    }
  }
});
